html {
  height: 100%;  /* Required for printing. */
}

body {
  background: black;
  bottom: 0;
  height: 100%;
  left: 0;
  margin: 0;
  overflow: hidden;
  position: absolute;
  top: 0;
  width: 100%;
}

.scrollbar-track {
  padding: 2px;
  position: fixed;
}

.scrollbar-track-horizontal {
  bottom: 0;
  left: 0;
  right: 0;
}

.scrollbar-track-vertical {
  bottom: 0;
  right: 0;
  top: 0;
}

.scrollbar-thumb {
  background: white;
  border: 1px solid #555;
  border-radius: 3px;
  box-sizing: border-box;
  opacity: 0;
  position: absolute;
  transition: opacity 100ms;
}

body.controls-visible .scrollbar-track .scrollbar-thumb {
  opacity: 0.4;
}

body.controls-visible .scrollbar-track .scrollbar-thumb:hover {
  opacity: 0.6;
}

body.controls-visible .scrollbar-track .scrollbar-thumb:active {
  opacity: 0.8;
}

.scrollbar-track-horizontal,
.scrollbar-track-horizontal .scrollbar-thumb {
  height: 8px;
}

.scrollbar-track-vertical,
.scrollbar-track-vertical .scrollbar-thumb {
  width: 8px;
}

.dynamic {
  opacity: 1;
  transition: opacity 200ms linear;
}

body:not(.controls-visible) .dynamic {
  opacity: 0;
  pointer-events: none;
}

#header {
  -webkit-app-region: drag;
  -webkit-box-pack: end;
  display: -webkit-box;
  height: 32px;
  left: 0;
  padding: 10px;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 100;
}

.buttons button,
.buttons input {
  -webkit-app-region: no-drag;
  border: none;
  height: 32px;
  margin: 2px;
  padding: 0;
  pointer-events: auto;
  width: 32px;
}

.buttons button {
  background: rgba(0, 0, 0, 0.75) center center no-repeat;
}

.buttons button:not([disabled]):hover,
.buttons input:not([disabled]):hover {
  background-color: rgba(60, 60, 60, 0.75);
}

.buttons button:not([disabled]):active,
.buttons input:not([disabled]):active {
  background-color: rgba(90, 90, 90, 0.75);
}

.buttons button:[disabled] {
  opacity: 0.75;
}

#toolbar-puller-wrapper {
  bottom: 0;
  left: 0;
  right: 0;
  pointer-events: auto;
  position: absolute;
}

#toolbar-puller-wrapper.puller-reset {
  transition: -webkit-transform 200ms;
}

#toolbar-background {
  background: rgba(32, 32, 32, 0.8);
  height: 500px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

#toolbar-stripe {
  margin: 8px 0;
  position: relative;
}

#toolbar #album-enter.flash {
  -webkit-animation: flashButton 300ms linear 2s 3;
}

@-webkit-keyframes flashButton {
  from {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.buttons {
  -webkit-box-align: end;
  -webkit-box-pack: end;
  bottom: 0;
  display: -webkit-box;
  left: 0;
  margin: -2px;
  padding: 10px;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 0;
}

.buttons.opposite-side {
  -webkit-box-pack: start;
}

.buttons.prev-to-middle {
  /* Start just before the take-picture button. */
  -webkit-margin-end: calc(50% + 73px/2);
  -webkit-box-pack: end;
}

.buttons.next-to-middle {
  /* Start just after the take-picture button. */
  -webkit-margin-start: calc(50% + 73px/2);
  -webkit-box-pack: start;
}

.buttons #album-enter {
  background-image: -webkit-image-set(
      url(../images/camera_button_album.png) 1x,
      url(../images/2x/camera_button_album.png) 2x);
}

.buttons #filters-toggle {
  background-image: -webkit-image-set(
      url(../images/camera_button_filters.png) 1x,
      url(../images/2x/camera_button_filters.png) 2x);
}

#toolbar .buttons {
  -webkit-box-align: center;
  padding: 0 10px;
}

#toolbar .buttons button:not(:hover):not(:active) {
  background-color: transparent;
}

.buttons #album-print,
.buttons #browser-print {
  background-image: -webkit-image-set(
      url(../images/browser_button_print.png) 1x,
      url(../images/2x/browser_button_print.png) 2x);
}

.buttons #album-export,
.buttons #browser-export {
  background-image: -webkit-image-set(
      url(../images/browser_button_export.png) 1x,
      url(../images/2x/browser_button_export.png) 2x);
}

.buttons #album-back,
.buttons #browser-back {
  background-image: -webkit-image-set(
      url(../images/gallery_button_back.png) 1x,
      url(../images/2x/gallery_button_back.png) 2x);
}

.buttons #album-delete,
.buttons #browser-delete {
  background-image: -webkit-image-set(
      url(../images/gallery_button_delete.png) 1x,
      url(../images/2x/gallery_button_delete.png) 2x);
}

.buttons #maximize-button {
  background-image: -webkit-image-set(
      url(../images/topbar_button_maximize.png) 1x,
      url(../images/2x/topbar_button_maximize.png) 2x);
}

.buttons #close-button {
  background-image: -webkit-image-set(
      url(../images/topbar_button_close.png) 1x,
      url(../images/2x/topbar_button_close.png) 2x);
}

#main-canvas-wrapper,
#main-fast-canvas-wrapper,
#main-canvas-wrapper canvas,
#main-fast-canvas-wrapper canvas {
  width: 100%;
}

#main-canvas-wrapper canvas,
#main-fast-canvas-wrapper canvas {
  pointer-events: none;
}

#error {
  -webkit-box-align: center;
  -webkit-box-orient: vertical;
  -webkit-box-pack: center;
  background: black;
  bottom: 0;
  color: white;
  display: none;
  font-size: 18px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 1;
}

#error .icon {
  background: center center no-repeat url(../images/no_camera.svg);
  height: 60px;
  margin-bottom: 20px;
  width: 90px;
}

#error .icon.animate {
  -webkit-animation: animateIcon 1.5s ease-out;
}

@-webkit-keyframes animateIcon {
  0% {
    -webkit-transform: translateY(0);
  }
  20% {
    -webkit-transform: translateY(10px);
  }
  30% {
    -webkit-transform: translateY(-150px) rotate(30deg);
  }
  80% {
    -webkit-transform: translateY(-120px) rotate(1050deg);
  }
  90% {
    -webkit-transform: translateY(10px) rotate(1080deg);
  }
  100% {
    -webkit-transform: rotate(1080deg);
  }
}

#error #error-msg,
#error #error-msg-hint {
  text-align: center;
}

#error #error-msg-hint {
  font-size: 16px;
}

body.has-error #error {
  display: -webkit-box;
}

body.mirror canvas {
  -webkit-transform: scaleX(-1);
}

#effects-wrapper {
  position: relative;
}

#effects {
  margin-bottom: 8px;
  overflow: auto;
}

#effects .padder {
  display: -webkit-box;
  list-style-type: none;
  margin: 0;
  padding: 0 0 5px;
}

::-webkit-scrollbar {
  width: 0;
  height: 0;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: transparent;
  width: 0;
  height: 0;
}

#effects li {
  -webkit-box-align: center;
  -webkit-box-orient: vertical;
  -webkit-box-pack: start;
  -webkit-margin-end: 10px;
  display: -webkit-box;
  padding: 0;
}

#effects li:first-child {
  padding-left: 10px;
}

#effects li:last-child {
  padding-right: 10px;
}

#effects li div.preview-canvas-wrapper {
  border: 2px solid transparent;
  height: 80px;
  overflow: hidden;
  position: relative;
  width: 80px;
}

#effects li[selected] div.preview-canvas-wrapper {
  border: 2px solid rgb(66, 129, 244);
}

#effects li div.preview-canvas-padder {
  -webkit-box-align: center;
  -webkit-box-pack: center;
  bottom: 0;
  display: -webkit-box;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

#effects li canvas {
  height: 257px;  /* Forces hardware accelerated 2d canvas. */
  opacity: 1;
  position: absolute;
  top: 0;
  transition: opacity 200ms;
  width: 257px;
}

body.mirror #effects li canvas {
  right: 0;
}

#effects li span {
  -webkit-padding-before: 5px;
  color: white;
  display: block;
  font-size: 90%;
  text-align: center;
  width: 80px;
}

#buttons {
  -webkit-box-align: center;
  -webkit-box-pack: center;
  display: -webkit-box;
  margin-bottom: 5px;
}

#buttons button,
#buttons input {
  background-color: transparent;
  border: none;
  display: -webkit-box;
  margin: 0;
  padding: 0;
}

#buttons button[disabled],
#buttons input[disabled],
.buttons button[disabled],
.buttons input[disabled] {
  opacity: 0.75;
  pointer-events: none;
}

#buttons #take-picture {
  background-image: -webkit-image-set(
      url(../images/camera_button_picture.png) 1x,
      url(../images/2x/camera_button_picture.png) 2x);
  height: 37px;
  width: 73px;
}

#buttons #take-picture:hover {
  background-position: 0 -37px;
}

#buttons #take-picture:active {
  background-position: 0 -74px;
}

#buttons #take-picture[disabled] {
  background-position: 0 -111px;
}

#buttons #take-picture:focus {
  outline: none;
  position: relative;
}

#buttons #take-picture:focus:after {
  border: 2px solid rgba(229, 151, 0, 0.5);
  border-radius: 20px;
  bottom: -2px;
  content: '';
  display: block;
  left: -2px;
  position: absolute;
  right: -2px;
  top: -2px;
}

.buttons #toggle-timer {
  -webkit-appearance: none;
  background-image: -webkit-image-set(
      url(../images/camera_button_timer.png) 1x,
      url(../images/2x/camera_button_timer.png) 2x);
  height: 32px;
  width: 32px;
}

.buttons #toggle-multi {
  -webkit-appearance: none;
  background-image: -webkit-image-set(
      url(../images/camera_button_multi.png) 1x,
      url(../images/2x/camera_button_multi.png) 2x);
  height: 32px;
  width: 32px;
}

.buttons #toggle-mirror {
  -webkit-appearance: none;
  background-image: -webkit-image-set(
      url(../images/camera_button_mirror.png) 1x,
      url(../images/2x/camera_button_mirror.png) 2x);
  height: 32px;
  width: 32px;
}

.buttons #toggle-timer.animate,
.buttons #toggle-timer:not(:checked),
.buttons #toggle-multi:not(:checked),
.buttons #toggle-mirror:not(:checked) {
  background-position: 0 -32px;
}

body.controls-visible #toolbar,
body.controls-visible #header {
  opacity: 1;
}

#toolbar {
  -webkit-transform: translateY(100%);
  bottom: 52px;  /* Keep in sync with #toolbar.expanded. */
  left: 0;
  position: absolute;
  right: 0;
  transition: -webkit-transform 200ms ease,
              opacity 200ms linear;
}

body:not(.has-error) #toolbar.expanded {
  -webkit-transform: translateY(52px);
}

#picture-preview {
  bottom: 25%;
  left: 25%;
  pointer-events: none;
  position: absolute;
  right: 25%;
  top: 25%;
  z-index: 1;
}

#picture-preview img {
  pointer-events: auto;
}

#picture-preview img {
  -webkit-animation: animatePicture 1s 1s;
  -webkit-animation-fill-mode: forwards;
  border: 6px solid white;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
  position: absolute;
  transition: opacity 1s, -webkit-transform 1s;
  /* The animation properties are added from views/camera.js */
  width: 100%;
}

#picture-preview img.activated {
  -webkit-transform: scale(1.2) !important;  /* Override the inline style. */
  transition: opacity 1s, -webkit-transform 250ms;
  z-index: 1;
}

#camera,
#album,
#browser {
  bottom: 0;
  left: 0;
  outline: none;
  opacity: 0;
  overflow: auto;
  position: absolute;
  right: 0;
  top: 0;
  transition: opacity 200ms, visibility 0 200ms;
  visibility: hidden;
  z-index: 1;  /* Hack to enable touch scrolling in album. */
}

#camera {
  -webkit-box-align: center;
  display: -webkit-box;
  overflow: hidden;
}

#toast {
  -webkit-box-align: center;
  -webkit-box-pack: center;
  bottom: 0;
  display: -webkit-box;
  left: 0;
  pointer-events: none;
  opacity: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: opacity 250ms;
  z-index: 1;
}

#toast #toast-message {
  background: #1e1e23;
  border-radius: 16px;
  color: white;
  font-size: 16px;
  line-height: 32px;
  opacity: 0.9;
  padding: 0 16px;
}

#toast.visible {
  opacity: 1;
}

#performance-test {
  -webkit-box-align: center;
  -webkit-box-orient: vertical;
  -webkit-box-pack: center;
  bottom: 0;
  display: -webkit-box;
  left: 0;
  pointer-events: none;
  opacity: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: opacity 250ms;
  z-index: 1;
}

#performance-test .perf-test-msg {
  background: rgba(30, 30, 35, 0.75);
  border-radius: 32px;
  color: white;
  font-size: 24px;
  padding: 16px 32px;
}

#performance-test #perf-test-bar-wrapper {
  background: rgba(30, 30, 35, 0.5);
  border-radius: 32px;
  margin: 8px;
  width: 50%;
}

#performance-test #perf-test-bar {
  background: rgba(96, 255, 96, 0.8);
  border-radius: 32px;
  color: white;
  font-size: 16px;
  min-width: 32px;
  padding: 8px 0;
  text-align: center;
  width: 0;
}

#performance-test #perf-test-bubble-wrapper {
  -webkit-box-align: center;
  -webkit-box-orient: vertical;
  -webkit-box-pack: center;
  display: -webkit-box;
  width: 96px;
  height: 96px;
  margin-top: 60px;
}

#performance-test #perf-test-bubble {
  border-radius: 100px;
  color: white;
  font-size: 16px;
  line-height: 24px;
  padding: 32px;
  text-align: center;
  width: 24px;
}

body.performance-test #performance-test {
  opacity: 1;
}

body.performance-test * {
  pointer-events: none !important;
}

#album .buttons,
#browser .buttons {
  position: fixed;
}

#album {
  background: black;
}

#album .padder {
  padding: 15px;
}

#album img {
  -webkit-app-region: no-drag;
  border: 4px solid white;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
  margin: 10px;
  transition: -webkit-transform 50ms;
  vertical-align: middle;
  width: 170px;
}

#album img.selected {
  -webkit-transform: scale(1.2);
  border-color: rgb(66, 129, 244);
}

#browser {
  background: rgba(0, 0, 0, 0.8);
  outline: none;
  visibility: hidden;
}

body.camera #camera,
body.browser #browser,
body.album #album {
  opacity: 1;
  transition: opacity 200ms;
  visibility: visible;
}

#browser .padder {
  -webkit-box-align: center;
  -webkit-box-orient: horizontal;
  display: -webkit-box;
  height: 100%;
}

#browser img {
  border: 10px solid white;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
  display: -webkit-box;
  height: 72%;
  margin: 4%;
  pointer-events: auto;
  transition: -webkit-transform 200ms;
}

#browser div.bounds-padder {
  display: -webkit-box;
  height: 1px;  /* Required to make the element visible. */
  width: 50%;
}

#browser img.selected {
  -webkit-transform: scale(1.1);
}

/* Printing in the browser view. */
@media print {
  /* For the album view, do not restrict to one page. */
  html {
    height: 100%;  /* Required for printing. */
  }

  body {
    height: auto;
    overflow: visible;
    position: static;
    width: 100%;
  }

  body.album:not(.browser) #album {
    bottom: auto;
  }

  /* Reset background colors. */
  body,
  #album,
  #browser {
    background: transparent;
  }

  /* Hide the window's decoration and scroll bars. */
  #header,
  .buttons,
  .scrollbar-track {
    display: none;
  }

  /* Hide all root elements, except the printed view. */
  body.browser > :not(#browser),
  body.album:not(.browser) > :not(#album) {
    display: none;
  }

  /* Hide everything from the browse view, but the current one. */
  #browser .padder > :not(.selected) {
    display: none;
  }

  /* Reset styles to default on the borwser view, and set the maximum dimensions
     to 100%. */
  #browser img.selected {
    -webkit-transform: scale(1);
    border: none;
    box-shadow: none;
    height: auto;
    margin: auto;
    max-height: 100%;
    max-width: 100%;
    position: absolute;
    width: auto;
  }

  /* Reset styles to default on the album view. */
  #album img,
  #album img.selected {
    -webkit-transform: scale(1);
    border: none;
    box-shadow: none;
    height: auto;
    max-width: 30%;
  }
}

#tooltip {
  -webkit-transform: translateY(10px);
  left: 0;
  opacity: 0;
  padding: 5px;
  pointer-events: none;
  position: absolute;
  top: 0;
  white-space: nowrap;
  z-index: 100;
}

#tooltip-arrow {
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid #e0e0e0;
  bottom: 0;
  height: 0;
  left: 50%;
  margin: 0 -10px;
  position: absolute;
  width: 0;
}

#tooltip #tooltip-msg {
  background: #e0e0e0;
  padding: 10px;
}

body.controls-visible #tooltip.visible {
  -webkit-transform: translateY(0);
  transition: opacity 500ms, -webkit-transform 500ms;
  opacity: 1;
}

#dialog {
  -webkit-box-align: center;
  -webkit-box-pack: center;
  background: rgba(0, 0, 0, 0.8);
  bottom: 0;
  display: -webkit-box;
  left: 0;
  opacity: 1;
  position: absolute;
  right: 0;
  top: 0;
  transition: opacity 200ms, visibility 0;
  z-index: 1;
}

body:not(.dialog) #dialog {
  opacity: 0;
  transition: opacity 200ms, visibility 0 200ms;
  visibility: hidden;
}

#dialog #dialog-popup {
  -webkit-transform: translateY(20px);
  -webkit-box-orient: vertical;
  background: white;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
  padding: 20px;
  display: -webkit-box;
  transition: -webkit-transform 200ms;
}

body.dialog #dialog #dialog-popup {
  -webkit-transform: translateY(0);
}

#dialog #dialog-msg {
  -webkit-user-select: initial;  /* Allow copying the message. */
  cursor: text;
  font-size: 120%;
  max-height: 320px;
  max-width: 640px;
  overflow: auto;
  padding: 20px 0;
  white-space: pre-wrap;
}

#dialog #dialog-msg::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

#dialog #dialog-msg::-webkit-scrollbar-track {
  background: transparent;
}

#dialog #dialog-msg::-webkit-scrollbar-thumb {
  background: gray;
  width: 6px;
  height: 6px;
}

#dialog #dialog-buttons {
  -webkit-box-align: center;
  -webkit-box-orient: horizontal;
  -webkit-box-pack: end;
  display: -webkit-box;
}

#dialog #dialog-buttons button {
  padding: 5px 20px;
}

#initializing {
  background: black url(../images/spinner.svg) center / 16px no-repeat;
  bottom: 0;
  left: 0;
  opacity: 1;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 1;
}

body:not(.initializing) #initializing {
  opacity: 0;
  transition: opacity 200ms, visibility 0 200ms;
  visibility: hidden;
}

